UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kqe5DMpJcYWmuGcPzMB8qi319wFnx57pDV/LdFV5Bbo='
WHERE
key_id = 'dd25dfa4ebafedeee254c5760d16216d434e4317a1e4d37fcaccd603b68ea2c4'
AND (
token = 'kqe5DMpJcYWmuGcPzMB8qi319wFnx57pDV/LdFV5Bbo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)