UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RExiMaHEA2+PVdj6oFRHcdDt1MycYSEX9ohJ99/tOKM=' 
WHERE 
  key_id = '277359e01747074cae1c6530a63dd9e4b03e814ee2c823a014ed079d5ebccea5' 
  AND (
    token = 'RExiMaHEA2+PVdj6oFRHcdDt1MycYSEX9ohJ99/tOKM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027