UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1J5xhjmzeu0pSZIewfIZJHApYwzNYS079IwG4NR20+A='
WHERE
key_id = 'a497e1ba14cb34444b6e880aa9213b2f08278ec2b8844601c7a780098bea7d0d'
AND (
token = '1J5xhjmzeu0pSZIewfIZJHApYwzNYS079IwG4NR20+A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)