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