UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zj37N1pO2O4Vn2aUfPyAfVlInGYftwNoYvb+b0jS680=' 
WHERE 
  key_id = '4ad66ed3ac956a5a2c88b4d67aedfacf3a823ab86d97b55e8abc3f786270ee88' 
  AND (
    token = 'Zj37N1pO2O4Vn2aUfPyAfVlInGYftwNoYvb+b0jS680=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031