UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kU4wLZH5+KWzgtmBYO+433yQY/qY4RTiYoJ6528me9Q=' 
WHERE 
  key_id = '42b45f6b195da1ff4270bc7f8d6297ade858ec8c8fb6ccb2d2f3daee9e5af4e2' 
  AND (
    token = 'kU4wLZH5+KWzgtmBYO+433yQY/qY4RTiYoJ6528me9Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028