UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lioFCNyL//U6BaiyjZC8VPcPRNNLK3QsVu+uLGjfRqI=' 
WHERE 
  key_id = 'bafe33be810852aff8affd5f85813537ee9f79e4e0b92ade481f545236e3ca31' 
  AND (
    token = 'lioFCNyL//U6BaiyjZC8VPcPRNNLK3QsVu+uLGjfRqI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036