UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NLFhGPmMgAjBCDHT623/upCdAMz5FSH0xgNFNwVdMBA=' 
WHERE 
  key_id = '51de22411a259d2966217e7f3a19f97ba66771c79010f9890d4d7c39fe5f04ed' 
  AND (
    token = 'NLFhGPmMgAjBCDHT623/upCdAMz5FSH0xgNFNwVdMBA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038