UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UCtGdxcgERrNcRQf5CLJ4wGfmoQtkiDiARti8yD+Z5M=' 
WHERE 
  key_id = 'fa8f3e228872e844df1137f2f05f4834205139c5bba9852335de240c78eb3c89' 
  AND (
    token = 'UCtGdxcgERrNcRQf5CLJ4wGfmoQtkiDiARti8yD+Z5M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027