UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CQs81sGJ3iJtbecTmJiWQhkDwzo706UnlkGw+GMU9GU=' 
WHERE 
  key_id = '42b91dac0626506ea4dace0fa3224c66bdc60faabb9c68cac0c3583ae2b386d3' 
  AND (
    token = 'CQs81sGJ3iJtbecTmJiWQhkDwzo706UnlkGw+GMU9GU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052