UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V7jXu6Iqj0V0/9lbkxdwCo2Gh/ppXJzcldLj+C9Z+xE=' 
WHERE 
  key_id = '0c9fc63258a052d978ba4425cf4d2b5e06737bcf33d350832c5ef599ef0f01a8' 
  AND (
    token = 'V7jXu6Iqj0V0/9lbkxdwCo2Gh/ppXJzcldLj+C9Z+xE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025