UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qAzICFkt1yimO4GkdIUkIKnpWwwZU+E1vnirKMcnYjQ=' 
WHERE 
  key_id = '768f6f829b53eed28f602b0cbdfdf0d612fccad0cec6c183b72ce9b3a51fb6a1' 
  AND (
    token = 'qAzICFkt1yimO4GkdIUkIKnpWwwZU+E1vnirKMcnYjQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048