UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vjXkX0y0oqjI3ElchQP4TqID0gmwsUmS4hSvfQKyP4I=' 
WHERE 
  key_id = '21fa38e8baa80923065ab6eaeb0080d26666f199986a38c69aee41c3543313f0' 
  AND (
    token = 'vjXkX0y0oqjI3ElchQP4TqID0gmwsUmS4hSvfQKyP4I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041