UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h562LYYRWWup1xuyiKy/1OHjmDxkbgpkWbpVHsRC+bs=' 
WHERE 
  key_id = 'd49210126310f1af97d260b3ccc5af06d9ab8400d2cf51379fc682745b69747b' 
  AND (
    token = 'h562LYYRWWup1xuyiKy/1OHjmDxkbgpkWbpVHsRC+bs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028