UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1bcfFccibid2PNtAINCo+xwXJJteYZcSdpisxW2KAIc=' 
WHERE 
  key_id = '946381e45b154156d3382b42e9c715455dac0a980302f16c0d6dce8b40258b4d' 
  AND (
    token = '1bcfFccibid2PNtAINCo+xwXJJteYZcSdpisxW2KAIc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045