UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uZl+ajgmBCJLNJAcRt2eSiiygj8kEA/hxd9qEduGtvM=' 
WHERE 
  key_id = 'bd2b5cab0b7ffee7de66593cc842c3c2b7965c2f9cd24783428387e212757700' 
  AND (
    token = 'uZl+ajgmBCJLNJAcRt2eSiiygj8kEA/hxd9qEduGtvM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039