UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZxwywrgWm4LQdA4zt5Ge7k6YIIz7OGoVvLiDeGFVjOo=' 
WHERE 
  key_id = '5199237ffa468ead97ad5c2a576addb95c11768d71e1f7d6bcce88296eacb7b5' 
  AND (
    token = 'ZxwywrgWm4LQdA4zt5Ge7k6YIIz7OGoVvLiDeGFVjOo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025