UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2sj7WkwlLizgwrIHl9d0BpU0zON2mX2OCbGLneUq4kE=' 
WHERE 
  key_id = 'd930ec3971c0bafa7de72a740f03679f1e603f659afdc12995c4cff7830434b5' 
  AND (
    token = '2sj7WkwlLizgwrIHl9d0BpU0zON2mX2OCbGLneUq4kE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034