UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YDnc9SGaFsAOMvq2H9B1azJvLrqinfI2+vBJQzEllvQ=' 
WHERE 
  key_id = '01efea0ff052867a98ecb6adefa23ace938828fba9d416c3f9e3ba5f782c6a59' 
  AND (
    token = 'YDnc9SGaFsAOMvq2H9B1azJvLrqinfI2+vBJQzEllvQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039