UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+6Tl0Lio0ypeo+eURQFDI1fDaz+2j+rlRSuBwhZgGm8=' 
WHERE 
  key_id = 'd2c643047fc227d3a7f713e310f58edff50b0eff3cbacc70bed42b8715f6575d' 
  AND (
    token = '+6Tl0Lio0ypeo+eURQFDI1fDaz+2j+rlRSuBwhZgGm8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035