UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'enS35pfXcb733oeBktXLgAiZVe+Bto0f3Ps8eF/NV6I='
WHERE
key_id = 'ece4b1902c40827ee50aa06e3620735649b328f8f60353ed4ef26d95150ef035'
AND (
token = 'enS35pfXcb733oeBktXLgAiZVe+Bto0f3Ps8eF/NV6I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)