UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AMu7rjMp1+HtWsgYfHJk52faL0lZU8snEDuNxJVpmBQ=' 
WHERE 
  key_id = '8b567241332057677d85a6ac87b66b3b522bc9c1338c12d87de11b059a131544' 
  AND (
    token = 'AMu7rjMp1+HtWsgYfHJk52faL0lZU8snEDuNxJVpmBQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031