UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '77cBxqXUENeub7oef75eMeEVkPNpSIDCYeT9Ot9bFwo=' 
WHERE 
  key_id = '878bb897b2178a0b17aecfe2c579877c7c75a9fcec67205bbaf93a18f6afa384' 
  AND (
    token = '77cBxqXUENeub7oef75eMeEVkPNpSIDCYeT9Ot9bFwo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032