UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oF2Xvaxkl0Kcaj6Bv2eseCLagsdGYfRwX055soH5wj8='
WHERE
key_id = 'c0a8d828827405681a7f42cdc9eb20cb2793ad83afda640343a4c40d846086ab'
AND (
token = 'oF2Xvaxkl0Kcaj6Bv2eseCLagsdGYfRwX055soH5wj8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)