UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rtvG4IWC4fmZ1kIZWQ5A2h8ZlsPK98PE5ma9SbzHncs=' 
WHERE 
  key_id = 'b466da43ac6ab43f715711abdb206e144dd8cab52753770cca3e067e226b2d82' 
  AND (
    token = 'rtvG4IWC4fmZ1kIZWQ5A2h8ZlsPK98PE5ma9SbzHncs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036