UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HW2gAngCmYmgYTxe0+A0YMMOzymyQX0LS9fQJEtHREk='
WHERE
key_id = 'bc417169205c6db794e28ded05e1344750996ee55c1d55cc669a282c37abf65e'
AND (
token = 'HW2gAngCmYmgYTxe0+A0YMMOzymyQX0LS9fQJEtHREk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)