UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tNx+i45g01UP0V2GXgGUve3URn+ePr1t/Lubc40ZvJY=' 
WHERE 
  key_id = '5f7e4768dbf2ff25ae33ce8abe657062584c77f7b40b4b3897480904a21f5e64' 
  AND (
    token = 'tNx+i45g01UP0V2GXgGUve3URn+ePr1t/Lubc40ZvJY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028