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

Query time 0.00027