UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vSD/ycPj/XkN77wHPEU7mK+qTksj540e3QUu2gEud5Y=' 
WHERE 
  key_id = '7f9a10658322485cdde0493da57538f0141fd45c745bd55c8429ce1e1556e866' 
  AND (
    token = 'vSD/ycPj/XkN77wHPEU7mK+qTksj540e3QUu2gEud5Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055