UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WX1oRd0gNnVFvRysVVFDxZPXfaUD+dopxIVkeb9NjI8=' 
WHERE 
  key_id = '394c4c4552e1e54375257af4a2b039bad9113c434290bb07c875ef537cd3055b' 
  AND (
    token = 'WX1oRd0gNnVFvRysVVFDxZPXfaUD+dopxIVkeb9NjI8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024