UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WSQqgeEGAh6rfoHA2DbEsDzHtf8HhOQfPL3aTET+DnQ=' 
WHERE 
  key_id = '160400924722875bfb7831aecb012814b6656df945ab1530fe91ada58349192d' 
  AND (
    token = 'WSQqgeEGAh6rfoHA2DbEsDzHtf8HhOQfPL3aTET+DnQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026