UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'n8o1c9U/fFub4CRC2KJcq52O+STbp37A/YeBRuvvjQo='
WHERE
key_id = 'd310c4adfe515e9fb669bcd28c1555f20483ef549b9db32d8ebdc51a68f22276'
AND (
token = 'n8o1c9U/fFub4CRC2KJcq52O+STbp37A/YeBRuvvjQo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)