UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P+Huk6hZ1HOEx+hTfRs6um8ImMoHiTTH4wo4xLmAY0g=' 
WHERE 
  key_id = '765a0bfcccc7d31e29b741c1966ea069ef206e6502c28b185dcd3f49e13712c6' 
  AND (
    token = 'P+Huk6hZ1HOEx+hTfRs6um8ImMoHiTTH4wo4xLmAY0g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035