UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZU73YZN6PmIm1GotsrhCHpbaBFKLSeB+n5eptD/v4xw=' 
WHERE 
  key_id = '2e8360736c48d3b65354dace254be0f02664182e778a54fe4570401256ce8d94' 
  AND (
    token = 'ZU73YZN6PmIm1GotsrhCHpbaBFKLSeB+n5eptD/v4xw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029