UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aA35/cIFDOcPGjoWiXfIOwOTF8vidFl2sLQoY9cq+/8='
WHERE
key_id = 'bc0e90463513bbae75171ee8fd629255de65ca48fa3e386c4dbf48ac646f9aff'
AND (
token = 'aA35/cIFDOcPGjoWiXfIOwOTF8vidFl2sLQoY9cq+/8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)