UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C/XVUzX0BEnIP9le7F6wujJIqEyjt7CmQDgTbMK8t+o=' 
WHERE 
  key_id = '7589a456100deac7ee6fee4773c87bc3683ee7aad53d9509c9d9701bf86a04f0' 
  AND (
    token = 'C/XVUzX0BEnIP9le7F6wujJIqEyjt7CmQDgTbMK8t+o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041