UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v+lfkE7yf8RbUnnTV61MYDJXNywajmHNn31SwGLmX8k=' 
WHERE 
  key_id = 'f27cccb5cdb3bed7b3565db8ce346a82b5eee3ca30622ff7a5e4048db5012a29' 
  AND (
    token = 'v+lfkE7yf8RbUnnTV61MYDJXNywajmHNn31SwGLmX8k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027