UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aLHSJvX5ZqVY+6EMNfnKqjvfHlkDktufHReqk7wBO94='
WHERE
key_id = '40e2d3030cef69b310fa557463320ea21592ac3ff683984e8db709972f4bf1c5'
AND (
token = 'aLHSJvX5ZqVY+6EMNfnKqjvfHlkDktufHReqk7wBO94='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)