UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GXZoqpV51QrRCsrfOPytGOCm+W3kgzep/0Sx/K+YBPQ=' 
WHERE 
  key_id = 'f639133849c184cc110ec5d82b7a147559b01ed407b28a2eba69bb5181216b33' 
  AND (
    token = 'GXZoqpV51QrRCsrfOPytGOCm+W3kgzep/0Sx/K+YBPQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034