UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jQsGgx9kxfAIByQlciwLIY/vuoR02vZlT3LE+FqKxPk='
WHERE
key_id = 'f115fefa877e72223855bc1b9390e67d881165a0234cc4357dfb67538a51fd38'
AND (
token = 'jQsGgx9kxfAIByQlciwLIY/vuoR02vZlT3LE+FqKxPk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)