UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6JMwIHM3ROK4Jhd7mmijyUPkdSMjm1P6tUoZ0L4x4r0='
WHERE
key_id = 'd83c1abeaedaf51f5ff73e2ab66faa3b56bb1aa7ae98c0a7768ce6037f1e358f'
AND (
token = '6JMwIHM3ROK4Jhd7mmijyUPkdSMjm1P6tUoZ0L4x4r0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)