UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yKceDzqIi8o8RmT6wY5WX+Wis+Yz8hjmlJaNAj+PLDw=' 
WHERE 
  key_id = '9da4375c53e1f856d7e0e9362f5fc2f49ccf59b9515bf11614a9a83b7d0302b2' 
  AND (
    token = 'yKceDzqIi8o8RmT6wY5WX+Wis+Yz8hjmlJaNAj+PLDw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026