UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bN8vP0T3aAdj9YJx9cO4W13kcJEP5UMVBWeyjD4+OkQ=' 
WHERE 
  key_id = '82978bde8337184f38ba81165c2043c1c2693ae9677e9a936b3e9712f6eae61a' 
  AND (
    token = 'bN8vP0T3aAdj9YJx9cO4W13kcJEP5UMVBWeyjD4+OkQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032