UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oIVT9GVeP5uJGD7LHx5jQ7a+WlNoy+0sSmDP9AnDQpw='
WHERE
key_id = 'a09b593c60f96c31c5ff27660ce11a19aa12e6911c362782995c5c2d59ddc0fa'
AND (
token = 'oIVT9GVeP5uJGD7LHx5jQ7a+WlNoy+0sSmDP9AnDQpw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)