UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KQB8qbIeyqLRHhx9t0H7KAjMpq6H/HpxWQ7v4m74svg=' 
WHERE 
  key_id = '9d41353e8ea4ad958fa9b1117ab5055779df0b33a0e173d044a2b8f53b8cd889' 
  AND (
    token = 'KQB8qbIeyqLRHhx9t0H7KAjMpq6H/HpxWQ7v4m74svg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033