UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lw0veUJgYjeEj9KfyEN34gJjXOuq+E4iODODpy+gmKU=' 
WHERE 
  key_id = '5a24803935b9e0f925a5a89ab421b1d49566bc9432a91b7910c8ed5e4479c93b' 
  AND (
    token = 'lw0veUJgYjeEj9KfyEN34gJjXOuq+E4iODODpy+gmKU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031