UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zdRx77mYTSKf7jF3mrhMujPtvLLI7cc730q+63+03CM='
WHERE
key_id = 'b11a7f116e8f0f95f88196b858c40571ee47d523ae4aa0ed7b88fc3f418dd501'
AND (
token = 'zdRx77mYTSKf7jF3mrhMujPtvLLI7cc730q+63+03CM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)